GtkListBoxRow: add g_return_if_fail to grab_focus, don't crash
authorRafal Luzynski <digitalfreak@lingonborough.com>
Thu, 26 Feb 2015 01:15:18 +0000 (02:15 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 27 Feb 2015 11:31:06 +0000 (06:31 -0500)
Although gtk_list_box_row_grab_focus() is not a public function
it can be easily called by gtk_widget_grab_focus() with a row argument
which has been removed from the list box and has box == NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=744879

gtk/gtklistbox.c

index 06ccaee784c16e819c2925ace5b52951d7d83407..b270910a9a335304198e9197035d7dccf916bfaf 100644 (file)
@@ -3487,6 +3487,8 @@ gtk_list_box_row_grab_focus (GtkWidget *widget)
   GtkListBoxRow *row = GTK_LIST_BOX_ROW (widget);
   GtkListBox *box = gtk_list_box_row_get_box (row);
 
+  g_return_if_fail (box != NULL);
+
   if (BOX_PRIV (box)->cursor_row != row)
     gtk_list_box_update_cursor (box, row, FALSE);